<?php

/**异步通知基础类
 * @author ran.ran
 */
namespace api\controllers;

use yii\web\Controller;
class BaseCoreController extends Controller
{
    public function init(){
        parent::init();
        $this->enableCsrfValidation = false;
        $this->layout = false;
    }
    
    
    public function actions()
    {
        return parent::actions()+['error' => [
            'class' => 'yii\web\ErrorAction',
        ]];
    }
    
    
    /**
     * 移动端检测
     * @method isMobile
     * @since 0.0.1
     * @return {boolean}
     */
    public static function isMobile(){
        return isset($_SERVER['HTTP_X_WAP_PROFILE']) || (isset($_SERVER['HTTP_VIA']) && stristr($_SERVER['HTTP_VIA'], 'wap')) || (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(nokia|sony|ericsson|mot|samsung|htc|sgh|lg|sharp|sie-|philips|panasonic|alcatel|lenovo|iphone|ipod|blackberry|meizu|android|netfront|symbian|ucweb|windowsce|palm|operamini|operamobi|openwave|nexusone|cldc|midp|wap|mobile)/i', strtolower($_SERVER['HTTP_USER_AGENT'])));
    }
    
}

?>